////////////////////////////////////////////////////////////////////////////////////////////////
/// Success of Economic Sanctions Threats: Coercion, Information and Commitment            /////
/// Dawid Walentek, Joris Broere, Matteo Cinelli, Mark M. Dekker, and Jonas M. B. Haslbeck /////
////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////
/// last changed 3 November 2020 ///
////////////////////////////////////

////////////////////////////////////////
/// Analysis conducted with Stata 13 ///
////////////////////////////////////////


*************************
***** Data sources ******
*************************

 /// TIES data v.4.0
 /// Available at: http://sanctions.web.unc.edu
 /// Citation: Morgan, T. C., Bapat, N. and Kobayashi, Y. (2014) �Threat and imposition of economic sanctions 1945�2005: Updating the TIES dataset�, Conflict Management and Peace Science, 31(5), pp. 541�558. doi: 10.1177/0738894213520379.

 /// Polity IV data
 /// Available at: http://www.systemicpeace.org/inscrdata.html
 /// Citation: Marshall, M. G., Gurr, T. R. and Jaggers, K. (2018) �Polity IV Project�. Center for Systemic Peace. Available at: http://www.systemicpeace.org/inscrdata.html.

 /// Expanded Trade and GDP Data v.4.0
 /// Available at: http://ksgleditsch.com/exptradegdp.html
 /// Citation: Gleditsch, K., (2002). "Expanded Trade and GDP Data", Journal of Conflict Resolution,(46). DOI: 10.1177/0022002702046005006

 /// Political Regime (PR) data set
 /// Available at: https://journals.sagepub.com/doi/full/10.1177/0010414012463905
 /// Citation: Carles Boix, Michael K. Miller, and Sebastian Rosato. �A Complete Data Set of Political Regimes, 1800-2007.� Comparative Political Studies.

 /// Diplomatic Exchange (v2006.1) data set
 /// Available at: http://www.correlatesofwar.org/data-sets/diplomatic-exchange
 /// Citation: Bayer, Resat. 2006. �Diplomatic Exchange Data set, v2006.1.� Online:http://correlatesofwar.org

 /// Variaties of Democracy (V-Dem) data set
 /// Available at: https://doi.org/10.23696/vdemds20
 /// Citation: Coppedge, Michael, John Gerring, et al. 2020. �V-Dem [Country�Year/Country�Date] Dataset v10� Varieties of Democracy (V-Dem) Project

 /// Available at: http://www.correlatesofwar.org/data-sets/formal-alliances
 /// citation: Gibler, Douglas M. 2009. International military alliances, 1648-2008. CQ Press.

 /// Available at: https://doi.org/10.7910/DVN/NAMZXJ
 /// Citation: Kavakli, Kerim Can; Chatagnier, J. Tyson; Hatipoglu, Emre`, 2019, "The Power to Hurt and the Effectiveness of International Sanctions"

*****************************
****** Main Analysis ********
*****************************


*cd here insest your own path
use "Data_Sanctions_Nov2020", clear

///////////////////////
/// Summary statistics (Table 1)
///////////////////////

sum
outreg2 using Sum_Stat_Threats.doc, replace sum(log)

///////////////////////
/// Estimation results for the economic cost mechanism (Table 2)
///////////////////////

*** Control variables
local control us salience security  multilateral past_commitment democracy_score_target path 

*** Regression tables
logit success c.expected_cost_target `control' if threat==1 & imposition==0, r or
outreg2 using cost_reg.doc, replace ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.expected_cost_target##i.imposition `control' if threat==1, r or
outreg2 using cost_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.dependence_target `control' if threat==1 & imposition==0, r or
outreg2 using cost_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.dependence_target##i.imposition `control' if threat==1, r or
outreg2 using cost_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))

*** Margins (Figure 3)

*** Plots colour
grstyle init
grstyle set plain, grid
grstyle set color cblind 

 * Impact of expected target cost of economic sanctions on effectiveness of threats and imposed economic sanctions
 logit success c.expected_cost_target##i.imposition `control' if threat==1, r or
margins imposition, atmeans
mtable , at(expected_cost_target==(1(1)3) imposition=(0(1)1))
margins i.imposition, at(expected_cost_target==(1(1)3))
marginsplot 
marginsplot, recast(line) ytitle ("Pr(Success)") xtitle ("Expected Cost Target")
graph save exp_cost_margin, replace
graph export exp_cost_margin.pdf, replace

///////////////////////
/// Estimation results for the uncertainty mechanism (Table 3)
///////////////////////

*** Control variables
local control us salience security multilateral past_commitment expected_cost_target democracy_score_target

*** Regression tables
logit success c.path `control' if threat==1 & imposition==0, r or
outreg2 using uncertainty_reg.doc, replace ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.path##i.imposition `control' if threat==1, r or
outreg2 using uncertainty_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success i.alliance `control' if threat==1 & imposition==0, r or
outreg2 using uncertainty_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success i.alliance##i.imposition `control' if threat==1, r or
outreg2 using uncertainty_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))


*** Margins (Figure 4)
 * Impact of distance on the diplomatic network between the sender and the target on the effectiveness of threats and imposed economic sanctions
 label define label_1 0 "Threat only" 1 "Imposition"
label values imposition label_1
 label define label_2 0 "No" 1 "Yes"
label values alliance label_2

 logit success c.path##i.imposition `control', r or
margins imposition, atmeans
mtable , at(path==(1(1)5) imposition=(0(1)1))
margins i.imposition, at(path==(1(1)5))
marginsplot
marginsplot, recast(line) ytitle ("Pr(Success)") xtitle ("Path")
graph save path_margin, replace
graph export path_margin.pdf, replace

///////////////////////
/// Estimation results for the public commitment mechanism (Table 4)
///////////////////////

*** Control variables
local control us salience security  multilateral past_commitment expected_cost_target path 

*** Regression tables
logit success c.democracy_score_sender `control' if threat==1 & imposition==0, r or
outreg2 using domestic_reg.doc, replace ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.democracy_score_sender##i.imposition `control' if threat==1, r or
outreg2 using domestic_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success i.democracy_score_sender_pr `control' if threat==1 & imposition==0, r or
outreg2 using domestic_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success i.democracy_score_sender_pr##i.imposition `control' if threat==1, r or
outreg2 using domestic_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))

*** Margins (Figure 5)
 *  Impact of democracy level of the sender on effectiveness of threats and imposed economic sanctions
 logit success c.democracy_score_sender##i.imposition `control' if threat==1, r or
margins imposition, atmeans
mtable , at(democracy_score_sender==(0(1)10) imposition=(0(1)1))
margins i.imposition, at(democracy_score_sender==(0(1)10))
marginsplot 
marginsplot, recast(line) ytitle ("Pr(Success)") xtitle ("Democracy Score Sender")
graph save dem_sen_margin, replace
graph export dem_sen_margin.pdf, replace

*******************************
****** Online Appendix ********
*******************************

/////////////////////////////////////////////////////////
/// Estimation results for all three mechanisms combined (Table A.1)
/////////////////////////////////////////////////////////

*** Control variables
local control us salience security  multilateral past_commitment

*** Regression tables
logit success c.expected_cost_target c.democracy_score_sender c.path if threat==1 & imposition==0, r or
outreg2 using all_iv_reg.doc, replace ctitle(Odds ratio) eform addtext (Control variables, NO, Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.expected_cost_target c.democracy_score_sender c.path `control' if threat==1 & imposition==0, r or
outreg2 using all_iv_reg.doc, append ctitle(Odds ratio) eform addtext (Control variables, YES, Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.expected_cost_target##i.imposition c.path##i.imposition  c.democracy_score_sender##i.imposition `control' if threat==1, r or
outreg2 using all_iv_reg.doc, append ctitle(Odds ratio) eform addtext (Control variables, YES, Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))



/////////////////////////////////////////////////////////////////
/// Estimation results for all three mechanisms with additional control variables (Table A.2)
/////////////////////////////////////////////////////////////////

*** Control variables
local control us salience security  multilateral past_commitment expected_cost_sender democracy_score_target

*** Regression tables
logit success c.expected_cost_target c.democracy_score_sender c.path `control' if threat==1 & imposition==0, r or
outreg2 using all_iv_all_control_reg.doc, replace ctitle(Odds ratio) eform addtext (Control variables, YES, Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.expected_cost_target##i.imposition c.path##i.imposition  c.democracy_score_sender##i.imposition `control' if threat==1, r or
outreg2 using all_iv_all_control_reg.doc, append ctitle(Odds ratio) eform addtext (Control variables, YES, Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))

////////////////////////////////////////////////
/// Estimation results for the V-Dem data (Table A.3)
////////////////////////////////////////////////

*** Control variables
local control us salience security  multilateral past_commitment expected_cost_target path

 *** V-Dem variables:
  * Electoral democracy index (D) (elect_demo_sender_vdem)
  * Liberal democracy index (D) (lib_demo_sender_vdem)
  * Freedom of Expression and Alternative Sources of Information index (D) (freedom_sender_vdem)

*** Regression tables
logit success c.elect_demo_sender_vdem `control' if threat==1 & imposition==0, r or
outreg2 using vdem_reg.doc, replace ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.elect_demo_sender_vdem##i.imposition `control' if threat==1, r or
outreg2 using vdem_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.lib_demo_sender_vdem `control' if threat==1 & imposition==0, r or
outreg2 using vdem_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.lib_demo_sender_vdem##i.imposition `control' if threat==1, r or
outreg2 using vdem_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.freedom_sender_vdem `control' if threat==1 & imposition==0, r or
outreg2 using vdem_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, NO) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))
logit success c.freedom_sender_vdem##i.imposition `control' if threat==1, r or
outreg2 using vdem_reg.doc, append ctitle(Odds ratio) eform addtext (Interaction term, YES) addstat(Pseudo R2, e(r2_p), Log Lik, e(ll))

*** Margins (Figure A.1: Impact of the V-Dem variables � (a) Electoral democracy sender, (b) Liberal democ- racy sender and (c) Freedom of expression sender � on the effectiveness of threats and imposed sanctions.)

* (a) Electoral democracy sender
 logit success c.elect_demo_sender_vdem##i.imposition `control' if threat==1, r or
margins imposition, atmeans
mtable , at(elect_demo_sender_vdem==(0(0.1)1) imposition=(0(1)1))
margins i.imposition, at(elect_demo_sender_vdem==(0(0.1)1))
marginsplot 
marginsplot, recast(line) ytitle ("Pr(Success)") xtitle ("Electoral Democracy Index")
graph save elec_dem_margin, replace
graph export elec_dem_margin.pdf, replace

* (b) Liberal democ- racy sender
 logit success c.lib_demo_sender_vdem##i.imposition `control' if threat==1, r or
margins imposition, atmeans
mtable , at(lib_demo_sender_vdem==(0(0.1)1) imposition=(0(1)1))
margins i.imposition, at(lib_demo_sender_vdem==(0(0.1)1))
marginsplot 
marginsplot, recast(line) ytitle ("Pr(Success)") xtitle ("Liberal Democracy Index")
graph save lib_dem_margin, replace
graph export lib_dem_margin.pdf, replace

* (c) Freedom of expression sender
 logit success c.freedom_sender_vdem##i.imposition `control' if threat==1, r or
margins imposition, atmeans
mtable , at(freedom_sender_vdem==(0(0.1)1) imposition=(0(1)1))
margins i.imposition, at(freedom_sender_vdem==(0(0.1)1))
marginsplot 
marginsplot, recast(line) ytitle ("Pr(Success)") xtitle ("Freedom of Expression and Alternative Sources of Information Index")
graph save free_margin, replace
graph export free_margin.pdf, replace

///////////////////////
/// (Figure A.2:) Diagnostics for the logistic regression of the path variable with a moderating term:
///////////////////////

*** (a) The ROC curve
logit success c.expected_cost_target##i.imposition c.path##i.imposition  c.democracy_score_sender##i.imposition `control' if threat==1, r or
predict xb, xb
lroc, graphregion(color(white))
graph export path_lroc.pdf, replace

*** (b) standardised residuals
logit success c.expected_cost_target##i.imposition c.path##i.imposition  c.democracy_score_sender##i.imposition `control' if threat==1, r or
predict std_residual, rs
label variable std_residual "Standardized Residual"
drop if std_residual==.
generate index=_n
label variable index "Observation Number"
graph twoway (scatter std_residual index,msymbol(d)), xlabel(0(100)550) ylabel(-4(2)4) title("Plot of Standardized Residuals versus Observation Number") xtitle("Observation Number") ytitle("Standardized Residual") yline(0) graphregion(color(white))
graph export path_stdres.pdf, replace

*** (c) the Cook Distance
logit success c.expected_cost_target##i.imposition c.path##i.imposition  c.democracy_score_sender##i.imposition `control' if threat==1, r or
predict cook, dbeta
label variable cook "Cook Distance"
drop if cook==.
graph twoway (scatter cook index, msymbol(d)), xlabel (0(100)550) title("Plot of Cook Distance versus Observation Number") xtitle("Observation Number") ytitle("Cook Distance") graphregion(color(white))
graph export path_cook.pdf, replace
